Triplets with a given sum